﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TianShiProject.Models.CarService.Maintains;
using TianShiProject.Models.Common;
using Volo.Abp.Application.Services;

namespace TianShiProject.CarService.Maintains
{
    public class MaintainService : ApplicationService
    {
        private readonly IMaintainRepository _maintainRepository;
        public MaintainService(IMaintainRepository maintainRepository)
        {
            _maintainRepository = maintainRepository;
        }
        /// <summary>
        /// 显示维修记录
        /// </summary>
        /// <param name="name"></param>
        /// <param name="time"></param>
        /// <param name="cardnumber"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public async Task<PageResponse<MaintainDto>> GetShowMaintain(string name, DateTime? time, string cardnumber, int pageindex=1, int pagesize=3)
        {
            return await _maintainRepository.GetShowMaintain(name, time, cardnumber, pageindex, pagesize);
        }
        /// <summary>
        /// 删除维修记录
        /// </summary>
        /// <returns></returns>
        public async Task<int> DeleteDelMaintain(int id)
        {
            return await _maintainRepository.DeleteDelMaintain(id);
        }
        /// <summary>
        /// 批量删除维修记录
        /// </summary>
        /// <returns></returns>
        public async Task<int> DeleteDelsMaintain(string ids)
        {
            return await _maintainRepository.DeleteDelsMaintain(ids);
        }
        /// <summary>
        /// 编辑修改
        /// </summary>
        /// <param name="maintainDto"></param>
        /// <returns></returns>
        public async Task<int> PutUpdateMaintain(MaintainDto maintainDto)
        {
            return await _maintainRepository.PutUpdateMaintain(maintainDto);
        }
        /// <summary>
        /// 添加维修记录
        /// </summary>
        /// <param name="maintainDto"></param>
        /// <returns></returns>
        public async Task<int> PostAddMaintain(MaintainDto maintainDto)
        {
            return await _maintainRepository.PostAddMaintain(maintainDto);
        }
        /// <summary>
        /// 绑定
        /// </summary>
        /// <returns></returns>
        public async Task<PageResponse<CarDtos>> GetBind()
        {
            return await _maintainRepository.GetBind();
        }
    }
}
